<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>商品列表</title>
		<link rel="stylesheet" href="http://www.xyshopping.com:8848/qianduan/resources/css/back.css" />
		<script src="http://www.xyshopping.com:8848/qianduan/resources/js/jquery-1.11.3.min.js" type="text/javascript"></script>
		<script type="text/javascript" src="http://www.xyshopping.com:8848/qianduan/resources/js/jquery-heima-0.0.1.js"></script>
		<style type="text/css">
			.cate_tr {
				text-align: center;
			}

			.cate_tr:hover {
				background-color: white;
			}
		</style>
		<script>
			$(function() {
				HM.ajax("/category?md=list", "", function(vo) {
					var categories = vo.data;
					for (var i = 0; i < categories.length; i++) {
						var classValue = i % 2 == 0 ? "cate_tr tr_odd" : "cate_tr tr_even";

						var tr = "<tr class='" + classValue + "' >\n" +
							"\t\t\t\t\t\t\t\t<td>\n" +
							"\t\t\t\t\t\t\t\t\t" + (i + 1) + "\n" +
							"\t\t\t\t\t\t\t\t</td>\n" +
							"\t\t\t\t\t\t\t\t<td>\n" +
							"\t\t\t\t\t\t\t\t\t" + categories[i].cname + "\n" +
							"\t\t\t\t\t\t\t\t</td>\n" +
							"\t\t\t\t\t\t\t\t<td >\n" +
							"\t\t\t\t\t\t\t\t\t<a href=\"http://www.xyshopping.com:8848/qianduan/view/admin/category/edit.html?cid="+categories[i].cid+"\" class=\"a_button_edit\"></a>\n" +
							"\t\t\t\t\t\t\t\t\t&nbsp;&nbsp;\n" +
							"\t\t\t\t\t\t\t\t\t<a href='javascript:;' onclick='del(\""+categories[i].cid+"\")' class=\"a_button_del\"></a>\n" +
							"\t\t\t\t\t\t\t\t</td>\n" +
							"\t\t\t\t\t\t\t</tr>";
						$("#cate_list").append(tr);
					}
				})
			})
			function del(cid){
				if(confirm("宁确认删除该分类吗？")){
					HM.ajax("/category?md=del","cid="+cid, function(vo){
						//服务器响应成功，跳转到列表页面
						if(vo.code == 1){
							location.href = "list.html";
						}else{
							alert(vo.data);
						}
					})
				}
			}
		</script>
	</head>
	<body>
		<table cellSpacing="1" cellPadding="0" width="100%" align="center" bgColor="#f5fafe" border="0">
			<tbody>
				<tr>
					<td align="center" bgColor="#afd1f3">
						<strong>分类列表</strong>
					</td>
				</tr>
				<tr>
					<td align="right">
						<a href="add.html" target="mainFrame">添加</a>
					</td>
				</tr>
				<tr>
					<td>
						<table cellspacing="0" bordercolor="gray" border="1" style="width:100%;BORDER-COLLAPSE:collapse;">
							<thead>
								<tr style="FONT-WEIGHT: bold; FONT-SIZE: 12pt; HEIGHT: 25px; BACKGROUND-COLOR: #afd1f3;text-align: center;">
									<td width="18%">
										序号
									</td>
									<td width="47%">
										分类名称
									</td>
									<td width="7%">
										操作
									</td>
								</tr>
							</thead>

							<tbody id="cate_list">

							</tbody>
						</table>
					</td>
				</tr>
			</tbody>
		</table>

	</body>
</html>
